﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using limpalex.bbparser.Interfaces;

namespace limpalex.bbparser.Converters
{
    class StringCollectionConverter : IValueConverter
    {
        public object Convert(XmlNode value)
        {
            return ConvertFromString(value.InnerText);
        }

        public object ConvertFromString(string value)
        {
            if (string.IsNullOrEmpty(value))
                return new List<string>();
            return new List<string>(value.Split(new[] { ",", ";" }, StringSplitOptions.RemoveEmptyEntries));
        }
    }
}
